|
|
|
|
|
- Handling errors
- Position in the file
- ANSI / Unicode management
<DiskFile variable>.WriteLine (Function) In french: <Variable FichierDisque>.EcritLigne Writes a line to an external file. The characters required to go to the next line are automatically inserted at the end of the added line.
Syntax
Writing a line to an external file Hide the details
<Result> = <File used>.WriteLine(<Line to write>)
<Result>: Boolean - True if the write operation was performed to the specified file,
- False if an error occurs. To get more details on the error, use ErrorInfo with the errMessage constant.
<File used>: DiskFile variable Name of the DiskFile variable initialized with <DiskFile variable>.Open or <DiskFile variable>.Create. <Line to write>: Character string Line to be written to the file (up to 2GB). Remarks Handling errors <DiskFile variable>.WriteLine throws an error in the following cases: - the file is not opened,
- the file is not accessible in write mode,
- the file is locked by another computer or by another application,
- no disk space is available.
Attention The function <DiskFile variable>.WriteLine function can only be used on text files. This function does not support the binary 0 (the write operation is stopped). Position in the file When opening a file, the current position corresponds to: - the first file byte (by default),
- the last byte of the file is the file is opened in "addition" mode (foAdd constant).
<DiskFile variable>.WriteLine writes the specified elements from the current position. Once <DiskFile variable>.WriteLine has been executed, the current position is set to the last byte written. ANSI / Unicode management <DiskFile variable>.WriteLine is used to write: - a Unicode string in a Unicode file.
- an Ansi string in an Ansi file.
Remarks: - The size to be written to a Unicode file must be multiplied by two compared to an ANSI file.
- If an ANSI character string is written to a Unicode file (and vice versa), the conversion is implicitly performed.
| | | | | Format of the string passed as parameter | External file in ANSI format (<DiskFile variable>.Open or <DiskFile variable>.Create associated with the foAnsi constant) | External file in Unicode format (<DiskFile variable>.Open or <DiskFile variable>.Create associated with the foUnicode constant) | <DiskFile variable>.WriteLine function | ANSI | No conversion is required before the write operation | Automatic conversion of the string before the write operation | Unicode | Automatic conversion of the string before the write operation | No conversion is required before the write operation |
In WINDEV and WEBDEV projects, if the "Use ANSI strings at runtime" option is enabled in the project configuration description, the default opening mode is foAnsi (1st column). In WINDEV and WEBDEV projects, if the "Use UNICODE strings at runtime" option is enabled in the project configuration description, the default opening mode is foUnicode (second column). In the WINDEV Mobile projects, regardless of the version and mode, the opening mode used by default is foUnicode (second column). Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|